// import './assets/main.css'
import '@/assets/iconfont/iconfont.js'
import { createApp } from 'vue'
import stores from '@/stores'

import App from './App.vue'
import router from './router'

import ProgressBar from '@/components/progress-bar'

import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
dayjs.extend(utc)

async function enableMocking() {
  let { worker } = await import('./mock/browser')
  return worker.start({ onUnhandledRequest: 'bypass' })
}

let app = createApp(App)
function create() {
  app.use(ProgressBar)
  app.use(stores)
  app.use(router)
  app.mount('#app')
}
if (!import.meta.env.DEV || !APP_MOCK_ENABLE) {
  create()
} else {
  enableMocking().then(create)
}
export default app
